#ifndef UTIL_H
#define UTIL_H

#include "def.h"

void usage();
void die(int exit_code, char *format_string, ...);
void parse_user_options(int argc, char **argv, int *window_w, int *window_h, char **font, int *font_size);

uint64_t hash(unsigned char *str);

void scale_sdl_rect_center(SDL_Rect *rect, int w, int h, int max_w, int max_h);

cr_track *create_cr_track(uint64_t duration, char *file, char *album_tag, char *albumartist_tag, char *artist_tag, char *comment_tag, char *date_tag, char *genre_tag, char *title_tag, uint64_t discnumber_tag, uint64_t cr_tracknumber_tag, char *stream_tag);
void destroy_cr_track(cr_track *cr_track);
void print_cr_track(cr_track *cr_track);

cr_player *create_cr_player(char *aaa_mode, char *status, uint64_t vol_left, uint64_t vol_right, uint64_t position, bool repeat, bool repeat_current, bool shuffle);
void destroy_cr_player(cr_player *cr_player);
void print_cr_player(cr_player *cr_player);

int partr(uint32_t color);
int partg(uint32_t color);
int partb(uint32_t color);
int parta(uint32_t color);

int posx(int x, int w, int max_w);
int posy(int y, int w, int max_h);

#endif
